Optimal. Leaf size=119 \[ \frac {1}{2} \left (a^4+6 a^2 b^2-3 b^4\right ) x-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 119, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3167, 1819,
1816, 649, 209, 266} \begin {gather*} \frac {\sin ^2(c+d x) \left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right )}{2 d}+\frac {1}{2} x \left (a^4+6 a^2 b^2-3 b^4\right )-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {b^4 \tan (c+d x)}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 266
Rule 649
Rule 1816
Rule 1819
Rule 3167
Rubi steps
\begin {align*} \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx &=-\frac {\text {Subst}\left (\int \frac {(b+a x)^4}{x^2 \left (1+x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\text {Subst}\left (\int \frac {-2 b^4-8 a b^3 x-\left (a^4+6 a^2 b^2-b^4\right ) x^2}{x^2 \left (1+x^2\right )} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\text {Subst}\left (\int \left (-\frac {2 b^4}{x^2}-\frac {8 a b^3}{x}+\frac {-a^4-6 a^2 b^2+3 b^4+8 a b^3 x}{1+x^2}\right ) \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}+\frac {\text {Subst}\left (\int \frac {-a^4-6 a^2 b^2+3 b^4+8 a b^3 x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}+\frac {\left (4 a b^3\right ) \text {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{d}-\frac {\left (a^4+6 a^2 b^2-3 b^4\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {1}{2} \left (a^4+6 a^2 b^2-3 b^4\right ) x-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(477\) vs. \(2(119)=238\).
time = 6.29, size = 477, normalized size = 4.01 \begin {gather*} \frac {b^3 \left (\frac {\cos ^2(c+d x) (a+b \tan (c+d x))^5 \left (b^2+a b \tan (c+d x)\right )}{2 b^4 \left (a^2+b^2\right )}-\frac {\left (-5 a^2+3 b^2\right ) \left (\frac {1}{2} \left (4 a (a-b) (a+b)+\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (4 a (a-b) (a+b)-\frac {a^4-6 a^2 b^2+b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+b \left (6 a^2-b^2\right ) \tan (c+d x)+2 a b^2 \tan ^2(c+d x)+\frac {1}{3} b^3 \tan ^3(c+d x)\right )+4 a \left (\frac {1}{2} \left (5 a^4-10 a^2 b^2+b^4+\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+\frac {1}{2} \left (5 a^4-10 a^2 b^2+b^4-\frac {a^5-10 a^3 b^2+5 a b^4}{\sqrt {-b^2}}\right ) \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+5 a b \left (2 a^2-b^2\right ) \tan (c+d x)+\frac {1}{2} b^2 \left (10 a^2-b^2\right ) \tan ^2(c+d x)+\frac {5}{3} a b^3 \tan ^3(c+d x)+\frac {1}{4} b^4 \tan ^4(c+d x)\right )}{2 b^2 \left (a^2+b^2\right )}\right )}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.30, size = 155, normalized size = 1.30
method | result | size |
derivativedivides | \(\frac {a^{4} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-2 a^{3} b \left (\cos ^{2}\left (d x +c \right )\right )+6 a^{2} b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+4 a \,b^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+b^{4} \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) | \(155\) |
default | \(\frac {a^{4} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-2 a^{3} b \left (\cos ^{2}\left (d x +c \right )\right )+6 a^{2} b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+4 a \,b^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+b^{4} \left (\frac {\sin ^{5}\left (d x +c \right )}{\cos \left (d x +c \right )}+\left (\sin ^{3}\left (d x +c \right )+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) | \(155\) |
risch | \(\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} b^{4}}{8 d}+\frac {a^{4} x}{2}+3 a^{2} b^{2} x -\frac {3 b^{4} x}{2}-\frac {{\mathrm e}^{2 i \left (d x +c \right )} a^{3} b}{2 d}+\frac {{\mathrm e}^{2 i \left (d x +c \right )} a \,b^{3}}{2 d}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} b^{4}}{8 d}+\frac {2 i b^{4}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {8 i a \,b^{3} c}{d}-\frac {{\mathrm e}^{-2 i \left (d x +c \right )} a^{3} b}{2 d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} a \,b^{3}}{2 d}+\frac {3 i {\mathrm e}^{2 i \left (d x +c \right )} a^{2} b^{2}}{4 d}+4 i x a \,b^{3}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} a^{4}}{8 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} a^{4}}{8 d}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} a^{2} b^{2}}{4 d}-\frac {4 a \,b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(271\) |
norman | \(\frac {\left (-\frac {1}{2} a^{4}-3 a^{2} b^{2}+\frac {3}{2} b^{4}\right ) x +\left (-\frac {3}{2} a^{4}-9 a^{2} b^{2}+\frac {9}{2} b^{4}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {1}{2} a^{4}+3 a^{2} b^{2}-\frac {3}{2} b^{4}\right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{2} a^{4}+9 a^{2} b^{2}-\frac {9}{2} b^{4}\right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (8 a^{3} b -8 a \,b^{3}\right ) \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {8 b^{4} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {8 b^{4} \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 \left (a^{4}-6 a^{2} b^{2}-5 b^{4}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {\left (a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 \left (4 a^{3} b -4 a \,b^{3}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 \left (4 a^{3} b -4 a \,b^{3}\right ) \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (8 a^{3} b -8 a \,b^{3}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}-\frac {4 a \,b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}-\frac {4 a \,b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}+\frac {4 a \,b^{3} \ln \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) | \(528\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 135, normalized size = 1.13 \begin {gather*} \frac {8 \, a^{3} b \sin \left (d x + c\right )^{2} + {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{4} + 6 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} b^{2} - 8 \, {\left (\sin \left (d x + c\right )^{2} + \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )} a b^{3} - 2 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} b^{4}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.65, size = 136, normalized size = 1.14 \begin {gather*} -\frac {8 \, a b^{3} \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + 4 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right )^{3} - {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} d x\right )} \cos \left (d x + c\right ) - {\left (2 \, b^{4} + {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right )^{2}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.51, size = 128, normalized size = 1.08 \begin {gather*} \frac {4 \, a b^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, b^{4} \tan \left (d x + c\right ) + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} {\left (d x + c\right )} - \frac {4 \, a b^{3} \tan \left (d x + c\right )^{2} - a^{4} \tan \left (d x + c\right ) + 6 \, a^{2} b^{2} \tan \left (d x + c\right ) - b^{4} \tan \left (d x + c\right ) + 4 \, a^{3} b}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.23, size = 255, normalized size = 2.14 \begin {gather*} \frac {a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-3\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+4\,a\,b^3\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )+6\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-4\,a\,b^3\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )}{d}+\frac {\frac {a^4\,\sin \left (c+d\,x\right )}{8}+\frac {9\,b^4\,\sin \left (c+d\,x\right )}{8}+\frac {a^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {b^4\,\sin \left (3\,c+3\,d\,x\right )}{8}+\frac {a\,b^3\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {a^3\,b\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {3\,a^2\,b^2\,\sin \left (c+d\,x\right )}{4}-\frac {3\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}}{d\,\cos \left (c+d\,x\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________